package com.globefrog.framework.web.wrapper;

import java.io.ByteArrayInputStream;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;

/**
 * 请求流.
 *
 * @author : caijinbang
 * @date : Create in 2021-01-14
 */
public class RequestInputStream extends ServletInputStream {

  private final ByteArrayInputStream inputStream;

  public RequestInputStream(byte[] bytes) {
    this.inputStream = new ByteArrayInputStream(bytes);
  }

  @Override
  public boolean isFinished() {
    return false;
  }

  @Override
  public boolean isReady() {
    return false;
  }

  @Override
  public void setReadListener(ReadListener readListener) {
  }

  @Override
  public int read() {
    return this.inputStream.read();
  }
}
